package com.kmxd.ams.infra.system.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 定时任务配置
 *
 * @author ZuoLG
 * @since 2022-08-19
 */
@Data
@TableName("sys_jobs")
@Schema(description = "定时任务配置对象")
public class SysJobs implements Serializable {

  private static final long serialVersionUID = 1L;

  /** 主键ID */
  @JsonSerialize(using = ToStringSerializer.class)
  private Long id;

  /** 任务key值（使用bean名称） */
  private String taskKey;

  /** 任务名称 */
  private String name;

  /** 任务表达式 */
  private String cron;

  /** 状态(0.禁用; 1.启用) */
  private Boolean status;

  /** 创建人 */
  @TableField(fill = FieldFill.INSERT)
  @JsonSerialize(using = ToStringSerializer.class)
  private Long createBy;

  /** 创建时间 */
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @TableField(fill = FieldFill.INSERT)
  private Date createTime;

  /** 更新人 */
  @TableField(fill = FieldFill.INSERT_UPDATE)
  @JsonSerialize(using = ToStringSerializer.class)
  private Long updateBy;

  /** 更新时间 */
  @Schema(description = "更新时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @TableField(fill = FieldFill.INSERT_UPDATE)
  private Date updateTime;

  @Schema(description = "开始时间")
  @TableField(exist = false)
  private String runStartTime;

  @Schema(description = "结束时间")
  @TableField(exist = false)
  private String runEndTime;
}
